Micro-optimize cache primitives in librt.internal#20194
Conversation
Only one of these works at runtime, however.
|
Compiled mypy is expected to fail in CI, since we need to publish a new version of |
ilevkivskyi
left a comment
There was a problem hiding this comment.
LG, thanks! Just few minor things. I think it is fine to break CI for short time. It would be good to fix it before weekend (there may be some contributors who may be confused by the failure).
| @@ -1,19 +1,27 @@ | |||
| from mypy_extensions import u8 | |||
|
|
|||
| # TODO: Remove Buffer -- right now we have hacky support for BOTH the old and new APIs | |||
There was a problem hiding this comment.
When will we be able to remove it? Right after the new version of librt is published, right?
| with assertRaises(ValueError): | ||
| read_int(r) | ||
|
|
||
| def test_buffer_primitive_types() -> None: |
There was a problem hiding this comment.
You forgot to add calls to this tests, and to the two tests below (you only added test_buffer_grow()).
|
I will merge this soon. As discussed above, this is a bit tricky to merge, so I'm outlining the next steps below:
I've already tested locally that compiled mypy works with the new API when changed to use ReadBuffer/WriteBuffer. |
|
OK, sounds good. |
This breaks the ABI and API. The native.internal.Buffer class is now split into ReadBuffer and WriteBuffer classes. Also update smoke tests. See python/mypy#20194 for more context.
This new version has breaking API and ABI changes (see #20194).
This new version has breaking API and ABI changes (see #20194 for context). This is okay since we haven't made a public release with librt as a dependency yet. (Note that librt is part of the mypy project but distributed separately.)
This includes the following optimizations:
This improves the performance of a micro-benchmark that reads integers in a loop by 5%, but this could help more if we'd inline some of the smaller functions (in the future). By making the functions simpler, inlining is more feasible.
I'm not sure what's the best way to merge this -- maybe we'll need to have broken master for a while, and then we ca publish a new version of
librt, and then update mypy to work using the newlibrtversion.